<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>模板字符串</title>
</head>
<body>
    <div></div>
    <script>
        let number = 999;
        function test(){
           return "商信";
        }

        let text = "Hello";//普通字符串
        //1、定义字符串模板使用:反单引号 ``
        let tpl1 = `Hello`;//模板字符串
        //2、可以直接引用变量
        let tpl2 = `Hello ${number} world`;
        //3、可以进行计算
        let tpl3 = `Hello ${number-100} world`;
        //4、可以调用方法
        let tpl4 = `Hello world ${test()}`
        //5、支持换行和空格
        let tpl5 = `Hello
        world 你好！！`;
        let tpl6 = 'hello'+
        'world 你好！！';

        console.log(tpl2)
        console.log(tpl3)
        console.log(tpl4)
        console.log(tpl5)
        console.log(tpl6)

    </script>
</body>
</html>